package homework;

/**
 * Created by kevin on 15-1-4.
 */
public class TimeSlot {
    int room = 0;
    //hh:mm
    String startTime = null;

    //(a)constructor
    //put in Room No. & startTime
    public TimeSlot(int room,String startTime){
        this.room = room;
        this.startTime = startTime;
    }

    //(b)Instance method
    public boolean overlaps(TimeSlot s){
        //because i let room=0,if room is not equals 0,it's in use.
        if(room == 0){
            this.room = s.room;
            this.startTime = s.startTime;
            return true;
        }else {
        return false;
        }
    }

    /**(c)Instance method
        Room 41 09:06-10:06

     */
    public String toString(){
        int room = this.room;
        String startTime = this.startTime;
        String endTime = this.startTime + 1;
        return "Room " + room + " " + startTime + "- " + endTime;
    }
}
